<?php 
defined('IN_PHPCMS') or exit('Access Denied');
defined('UNINSTALL') or exit('Access Denied');

$agency_models = getcache('agency_model', 'model');
$agency_content_db = pc_base::load_model('agency_content_model');
$agency_content_db->query("DELETE FROM `v9_member_menu` WHERE m='agency'");
$model_db = pc_base::load_model('sitemodel_model');
if (is_array($agency_models)) {
	foreach ($agency_models as $mid => $_m) {
		$agency_content_db->set_model($mid);
		$table_name = $agency_content_db->table_name;
		$agency_content_db->query("DROP TABLE IF EXISTS `$table_name`");
		$table_name_data = $table_name.'_data';
		$agency_content_db->query("DROP TABLE IF EXISTS `$table_name_data`");
		$model_db->delete(array('modelid'=>$mid));
	}
}
?>